package com.paperobot.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;

import com.paperobot.model.Admin;


public class AdminHomePageAction extends BaseAction{

	private static final long serialVersionUID = 1516834338392982332L;
	
	private String type;
	private final int userType = 1;
	private Admin loginUser;

	
	public String showMainPage() {
		HttpServletRequest request = ServletActionContext.getRequest();
		HttpSession session = request.getSession(true);
		loginUser = (Admin) session.getAttribute("loginUser");
		
		type = request.getParameter("type");
		if(type==null){
			if(userType == loginUser.getType()){
				return "yhxx";
			}else{
				return "gryh";
			}
		}else if(type.equals("yhxx")){
			if(userType == loginUser.getType()){
				return "yhxx";
			}else{
				return "gryh";
			}
		}else if(type.equals("tjyh")){
			if(userType == loginUser.getType()){
				return "tjyh";
			}else{
				return "wqyh";
			}
		}else if(type.equals("lwxx")){
			return "lwxx";
		}else if(type.equals("tjlw")){
			return "tjlw";
		}else if(type.equals("lbxx")){
			return "lbxx";
		}else if(type.equals("tjlb")){
			return "tjlb";
		}else if(type.equals("zxxx")){
			return "zxxx";
		}else if(type.equals("tjzx")){
			return "tjzx";
		}else if(type.equals("qkxx")){
			return "qkxx";
		}else if(type.equals("tjqk")){
			return "tjqk";
		}else {
			return ERROR;
		}
		
		
		
	}

	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String showTopPage(){
		return SUCCESS;
	}
	public String showLeftPage() {
		return SUCCESS;
	}
	public Admin getLoginUser() {
		return loginUser;
	}
	public void setLoginUser(Admin loginUser) {
		this.loginUser = loginUser;
	}
	
}
